package com.zyp.facade;


/**
 * 
 * 计算机类：作为CPU,Memory,Disk三个子类的高层接口。
 * 
 * 降低三个子类的耦合度
 *
 */
public class Computer {
	
	private CPU cpu;
	private Memory memory;
	private Disk disk;
	
	public Computer(){
		cpu=new CPU();
		memory=new Memory();
		disk=new Disk();
	}
	

	public void start(){
		System.out.println("start computer");
	
		cpu.start();
		memory.start();
		disk.start();
		
		System.out.println("computer start finished");
	}
	
	public void shutdown(){
		System.out.println("shutdown computer");
		
		cpu.shutdown();
		memory.shutdown();
		disk.shutdown();
		
		System.out.println("shutdown start finished");
	}
	
}

class CPU {
	
	public void start() {
		System.out.println("CPU start");
	}

	public void shutdown() {
		System.out.println("CPU shutdown");
	}

}
class Memory {
	
	public void start() {
		System.out.println("Memory start");
	}

	public void shutdown() {
		System.out.println("Memory shutdown");
	}

}
class Disk {
	
	public void start() {
		System.out.println("Disk start");
	}

	public void shutdown() {
		System.out.println("Disk shutdown");
	}

}



